package com.shzg.im.model.comparator;

import java.util.Comparator;

import com.shzg.im.model.Message;

public class MessageSendTimeComparator implements Comparator<Message> {

    @Override
    public int compare(Message msg1, Message msg2) {

        long diff = msg1.getSendTime().getTime() - msg2.getSendTime().getTime();
        if (diff > 0) {
            return 1;
        } else if (diff == 0) {
            return 0;
        } else {
            return -1;
        }
    }

}
